package cn.tedu.spring.scope;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @author tune_the last
 * @date 2025/11/6 - 17:41
 *
 * Scope注解：作用域的注解；
 *  1.singleton：单例 ------默认
 *  2.prototype：多例
 */
//@Scope("prototype")
@Component
public class Order {
    @Value("20")
    private int price;

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
        System.out.println("set方法执行");
    }

    @Override
    public String toString() {
        return "Order{" +
                "price=" + price +
                '}';
    }
}
